import React, { useState, useCallback } from "react";

export default function UseCallbackTest() {
  const [count, setCount] = useState(0);

  const add = useCallback(() => {
    setCount((x) => x + 1);
  }, []);
  return (
    <div>
      <p>{count}</p>
      <button onClick={add}>add</button>
    </div>
  );
}
